/**
 * 점수관리를 위한 스크립트
 * date : 2014.11.3 
 * 작성자 : kyun
 */

//var btnlist, btninput, btnview, btnmodify, btndelete;
var url='index.jsp?inc=../score/';
function general()
{
	
	btnlist=document.getElementById('btnlist');
	if(btnlist!=null)
	{
		btnlist.onclick=function()
		{
			var frm=document.hiddenFrm;
			frm.action=url+'list.jsp';
			frm.submit();
		}
	}
	btninput=document.getElementById('btninput');
	if(btninput!=null)
	{
		btninput.onclick=function()
		{
			var frm=document.hiddenfrm;
			frm.action=url+'input.jsp';
			frm.submit();
			//location.href=url+'input.jsp';
		}
	}
	btnview=document.getElementById('btnview');
	if(btnview!=null)
	{
		btnview.onclick=function()
		{
			location.href=url+'view.jsp';
		}
	}
	btnmodify=document.getElementById('btnmodify');
	if(btnmodify!=null)
	{
		btnmodify.onclick=function()
		{
			location.href=url+'modify.jsp';
		}
	}
	btndelete=document.getElementById('btndelete');
	if(btndelete!=null)
	{
		btndelete.onclick=function()
		{
			var b = confirm("정말 ?!!");
			if(b)
			{
				var rno=document.hiddenFrm.rno.value;
				location.href=url+'delete_result.jsp&rno='+rno;
			}
			else
			{
				alert("그래~ 삭제하지마..ㅋㅋ");
			}
		}
	}
}
function saveda()
{
	document.getElementById('btnsave').onclick=function()
	{
		if(document.getElementById('btnsave')!=null)
		{
			var f= document.frm;
			if(f.mid.value=='')
			{
				alert('아이디입력 ㄱㄱ');
				f.mid.focus();
			}
			else
			{
				f.submit();
			}
		}
	}	
}
function goPage(page){
	var mf = document.hiddenfrm;
	mf.nowPage.value = page;
	mf.find.value = document.score_list_frm.find.value;
	mf.action = 'index.jsp?inc=../score/list.jsp';
	mf.submit();
	//alert(page);
	//location.href=url + 'view.jsp&page=' + page;
}
function goview(page, rno)
{
	var mf = document.hiddenfrm;
	mf.nowPage.value = page;
	mf.rno.value=rno;
	mf.find.value = document.score_list_frm.find.value;
	mf.action = 'index.jsp?inc=../score/view.jsp';
	mf.submit();
}
function deleteinit()
{
	general();
}
function inputinit()
{
	general();
	saveda();
}
function listinit()
{
	general();
}
function modifyinit()
{
	general();
	saveda();
}
function viewinit()
{
	general();
}
